package com.liao.badminton.dto;

import com.liao.badminton.code.BaseField;
import com.liao.badminton.code.validation.Delete;
import com.liao.badminton.code.validation.Update;
import io.swagger.annotations.ApiModelProperty;
import com.liao.badminton.entity.UserGroupRef;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.List;
import lombok.Data;
import com.liao.badminton.code.validation.FindDetail;

/**
* @author liaocheng
* @date 2024-11-01
* description:用户和群关系
*/
@Data
public class UserGroupRefDto extends BaseField {

    @ApiModelProperty(value = "id")
    @NotNull(message = "主键id不能为空",groups = {Update.class, FindDetail.class})
    private Long id;

    @ApiModelProperty(value = "群id")
    private Long groupId;

    @ApiModelProperty(value = "用户id")
    private Long userId;

    @ApiModelProperty(value = "用户名称")
    private String userName;
    @ApiModelProperty(value = "用户分享码：群主邀请用户时用")
    private String userCode;

    @ApiModelProperty(value = "-1:申请加入,0:普通成员,1:管理员,2:群主")
    private Integer adminType;

    @ApiModelProperty(value = "参加打水次数")
    private Integer competitionNum;

    @ApiModelProperty(value = "参加活动次数")
    private Integer activityNum;

    @ApiModelProperty(value = "活动消费")
    private BigDecimal activityCost;

    @ApiModelProperty(value = "总局数")
    private Integer totalBout;

    @ApiModelProperty(value = "总胜局数")
    private Integer winBout;

    @ApiModelProperty(value = "总负局数")
    private Integer loseBout;

    @ApiModelProperty(value = "总得分")
    private Integer totalScore;

    @ApiModelProperty(value = "总奖励")
    private BigDecimal awardCoin;
    @ApiModelProperty(value = "默认登录群：0否，1是")
    private Integer loginDefault;
    @ApiModelProperty(value = "性别：0女，1男")
    private Integer sex;

    //非数据库字段
    @ApiModelProperty(value = "1：总奖励，2：胜率，3：总局数，4：打水次数，5：活动次数，6：消费")
    private Integer orderByType = 1 ;
    @ApiModelProperty(value = "1：升序(小->大)，2：降序（大->小）")
    private Integer orderByTypeDesc =2;


    @NotNull(message = "主键id不能为空",groups = {Delete.class})
    private List<Long> delIds;  //批量删除ids

    public UserGroupRef invertEntity(){
        UserGroupRef dto = new UserGroupRef();
        BaseField.invert(this, dto);
        dto.setId(this.getId());
        dto.setGroupId(this.getGroupId());
        dto.setUserId(this.getUserId());
        dto.setUserName(this.getUserName());
        dto.setAdminType(this.getAdminType());
        dto.setCompetitionNum(this.getCompetitionNum());
        dto.setActivityNum(this.getActivityNum());
        dto.setActivityCost(this.getActivityCost());
        dto.setTotalBout(this.getTotalBout());
        dto.setWinBout(this.getWinBout());
        dto.setLoseBout(this.getLoseBout());
        dto.setTotalScore(this.getTotalScore());
        dto.setAwardCoin(this.getAwardCoin());
        dto.setLoginDefault(this.getLoginDefault());
        dto.setSex(this.getSex());
        return dto;
    }
}
